var a = require("../../../../@babel/runtime/helpers/interopRequireDefault")(require("../../../../@babel/runtime/regenerator")), t = require("../../../../@babel/runtime/helpers/asyncToGenerator"), e = getApp();

Page({
    data: {
        active: 0,
        display1: -1,
        display2: -1,
        list_title: [],
        list_data: [],
        requestData: {},
        pageData: {},
        page: 1,
        total_page: 0,
        isLoadMore: !0
    },
    onLoad: function(a) {
        this.getData();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    changeTags: function(a) {
        console.log(a.detail.index, this.data.active), this.initData(), this.data.active = a.detail.index, 
        this.getData(a.detail.index);
    },
    openDetail: function(a) {
        console.log(a.currentTarget.dataset.ind2), console.log(this.data.display1), a.currentTarget.dataset.ind1 != this.data.display1 || a.currentTarget.dataset.ind2 != this.data.display2 ? this.setData({
            display1: a.currentTarget.dataset.ind1,
            display2: a.currentTarget.dataset.ind2
        }) : this.setData({
            display1: "-1",
            display2: "-2"
        });
    },
    onUnload: function() {},
    initData: function() {
        this.data.page = 1, this.data.requestData = {};
    },
    getData: function() {
        var i = arguments, s = this;
        return t(a.default.mark(function t() {
            var n, d;
            return a.default.wrap(function(a) {
                for (;;) switch (a.prev = a.next) {
                  case 0:
                    null != (n = i.length > 0 && void 0 !== i[0] ? i[0] : null) && (s.data.requestData.dividend_type = n), 
                    d = e.getNetAddresss("plugin.team-sztt.api.index"), e._getNetWork({
                        url: d,
                        data: s.data.requestData,
                        success: function(a) {
                            var t = a.data;
                            1 == t.result ? (s.data.isLoadMore = !0, s.data.total_page = t.data.lastpage, s.data.total_page || (s.data.isLoadMore = !1, 
                            s.data.total_page = 0), wx.setNavigationBarTitle({
                                title: t.data.plugin_name
                            }), s.setData({
                                pageData: t.data,
                                list_title: t.data.list_title,
                                list_data: t.data.list
                            })) : wx.showToast({
                                title: t.msg,
                                icon: "none",
                                duration: 1e3
                            });
                        }
                    });

                  case 4:
                  case "end":
                    return a.stop();
                }
            }, t);
        }))();
    },
    getMoreData: function() {
        var a = this;
        if (this.data.page == this.data.total_page) return wx.showToast({
            title: "没有更多",
            icon: "none",
            duration: 1e3
        }), void this.setData({
            isLoadMore: !1
        });
        this.data.page++;
        var t = e.getNetAddresss("plugin.team-sztt.api.index"), i = {
            page: this.data.page
        };
        Object.assign(i, this.data.requestData), e._getNetWork({
            url: t,
            data: i,
            success: function(t) {
                var e = t.data;
                if (1 != e.result) return a.data.page--, void (a.data.isLoadMore = !1);
                a.data.isLoadMore = !0, a.data.total_page = e.data.lastpage, a.data.total_page || (a.data.total_page = 0);
                var i = a.data.list_data.concat(e.data.list);
                a.setData({
                    list_data: i
                });
            }
        });
    },
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this.getMoreData() : wx.showToast({
            title: "没有更多数据",
            icon: "none"
        });
    },
    onShareAppMessage: function() {}
});